Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add service_name label earlier in the ingestion pipeline #13702

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

MasslessParticle
Copy link
Contributor

If discover_service_name is enabled, this pr injects the service_name as part of the request parsing so we can do interesting things with it earlier than we could before.

@MasslessParticle MasslessParticle requested a review from a team as a code owner July 29, 2024 21:35
lbs = lb.Set(LabelServiceName, serviceName).Labels()
s.Labels = lbs.String()

// Remove the added label after it's added to the stream so it's not consumed by subsequent steps
Copy link
Member

@na-- na-- Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is the right call here 🤔 It's consistent with the current behavior so far, but I think it might be a bit confusing to users. They will suddenly see service_name everywhere, so they might wonder why they couldn't configure their retention periods with it too, right? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is kind of confusing but I believe the tenant retentions bytes here are used for billing so I'm a bit cautious to change it.

Also we've not made anything worse 😅

Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, though I am not sure whether this makes sense for UX: https://github.com/grafana/loki/pull/13702/files#r1696836742

(though I am also not sure if we'll cause issues by keeping service_name there either)

expectedBytes: len("fizzbuzz"),
expectedLines: 1,
expectedBytesUsageTracker: map[string]float64{`{foo="bar2"}`: float64(len("fizzbuss"))},
expectedLabels: labels.FromStrings("foo", "bar2", LabelServiceName, ServiceUnknown),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectedLabels I can't find its usage in the test 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I really thought I added it here but I must not have because one of the tests was wrong.


lb := labels.NewBuilder(lbs)
lbs = lb.Set(LabelServiceName, serviceName).Labels()
s.Labels = lbs.String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we also need to set it back req.Streams[i] = s

@MasslessParticle MasslessParticle merged commit 573a184 into main Jul 30, 2024
61 checks passed
@MasslessParticle MasslessParticle deleted the tpatterson/insert-service-name-sooner branch July 30, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants